package com.atguigu.yygh.order.receiver;

import com.atguigu.common.rabbit.constant.MqConst;
import com.atguigu.yygh.order.service.OrderService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author ybl
 * @version 1.9
 * @date 2021/5/31 17:32
 *   监听队列 执行操作
 */
@Component
public class OrderReceiver {

  @Autowired
  private OrderService orderService;

  //  监听队列消息
  @RabbitListener(bindings = {
      @QueueBinding(
          value = @Queue(value = MqConst.QUEUE_TASK_8,durable = "true"),
          exchange = @Exchange(value = MqConst.EXCHANGE_DIRECT_TASK),
          key = {MqConst.ROUTING_TASK_8}
      )
  })
  public void patientTips(Message message, Channel channel) {
    orderService.patientTips();
  }
}
